<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>展示</title>
    <style type="text/css">
        .odd{background-color:yellow}
    </style>
    <script type="text/javascript" th:src="@{/js/jquery-1.12.4.js}"></script>
    <script type="text/javascript">
        $(function(){

        })

        function del(fid){
            if(confirm("是否删除?")){
                window.location.href="del?fid="+fid;
            }
        }
    </script>
</head>
<body>
    <center>
        <h1 th:text="${str}"></h1>
        <h3><a th:href="@{toAdd}">新增</a></h3>
        <div>
            <table border="1">
                <tr th:class="odd">
                    <td>编号</td>
                    <td>姓名</td>
                    <td>别名</td>
                    <td>科属</td>
                    <td>价格</td>
                    <td>产地</td>
                    <td>操作</td>

                </tr>
                <tr th:each="f,fstate:${flist}" th:class="${fstate.even}?'odd':''">
                    <td th:text="${f.fid}"></td>
                    <td th:text="${f.fname}"></td>
                    <td th:text="${f.asname}"></td>
                    <td th:text="${f.property}"></td>
                    <td th:text="${f.price}"></td>
                    <td th:text="${f.address}"></td>
                    <td>
                        <a th:href="@{/toUpdate(fid=${f.fid})}">修改</a>
                        <a href="javascript:void(0)" th:onclick="del([[${f.fid}]])" >删除</a>
                    </td>
                </tr>
            </table>
        </div>
        <p>
            <span th:text="'第'+${flist.getPageNum()}+'页'"></span>/
            <span th:text="'共'+${flist.getPages()}+'页'"></span>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <a th:href="@{list(index=1)}">首&nbsp;&nbsp;页</a>
            <a th:href="@{list(index=${flist.getPageNum()}-1)}">上一页</a>
            <a th:href="@{list(index=${flist.getPageNum()}+1)}">下一页</a>
            <a th:href="@{list(index=${flist.getPages()})}">末&nbsp;&nbsp;页</a>
        </span>
    </center>
</body>
</html>